package com.yang.controller;

import com.yang.annotation.SystemLog;
import com.yang.domain.Result;
import com.yang.domain.entity.User;
import com.yang.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/userInfo")
    public Result userInfo(){
        return userService.userInfo();
    }


    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public Result updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @PostMapping("/register")
    @SystemLog(businessName = "新增用户信息")
    public Result registerUser(@RequestBody User user){
        return userService.registerUser(user);
    }
}
